Click here for interactive plots:

https://kforthman.shinyapps.io/COVID19_Interactive_Plots/

Click here to see how cities and counties overlap:

https://kforthman.shinyapps.io/500citiescounties

Compare COVID stats to Neighborhood Factors

data.cor <- cor(county.Demo_and_Covid.allcounties[,-1], use = "complete.obs", method = "spearman")
corrplot.mixed(data.cor, upper = 'ellipse', lower = 'number', tl.pos = 'lt', tl.cex = 1, lower.col = "black", number.cex = 0.5)

Compare COVID stats to 500 cities data and Neighborhood Factors

data.cor2 <- cor(county.Demo_and_Covid.500counties[,-c(1:2)], use = "complete.obs", method = "spearman")
corrplot.mixed(data.cor2, upper = 'ellipse', lower = 'number', tl.pos = 'lt', tl.cex = 1, lower.col = "black", number.cex = 0.5)

corrplot.mixed(data.cor2[7:13,c(1:5, 14:42,6)], upper = 'ellipse', tl.pos = 'lt', tl.cex = 1, lower.col = "black", number.cex = 0.5)

—-Linear Mixed Effects Model —-

this.lme <- lmer("total.cases.percap ~ Affluence + Singletons.in.Tract + Seniors.in.Tract + African.Americans.in.Tract + Noncitizens.in.Tract + High.BP + Binge.Drinking + Cancer + Asthma + Heart.Disease + COPD + Smoking + Diabetes + No.Physical.Activity + Obesity + Poor.Sleeping.Habits + Poor.Mental.Health + Testing_Rate + Hospitalization_Rate + (1 | stateID)", data = county.Demo_and_Covid.500counties)
## Warning: Some predictor variables are on very different scales: consider
## rescaling

## Warning: Some predictor variables are on very different scales: consider
## rescaling
print(summary(this.lme), correlation=TRUE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: 
## "total.cases.percap ~ Affluence + Singletons.in.Tract + Seniors.in.Tract + African.Americans.in.Tract + Noncitizens.in.Tract + High.BP + Binge.Drinking + Cancer + Asthma + Heart.Disease + COPD + Smoking + Diabetes + No.Physical.Activity + Obesity + Poor.Sleeping.Habits + Poor.Mental.Health + Testing_Rate + Hospitalization_Rate + (1 | stateID)"
##    Data: county.Demo_and_Covid.500counties
## 
## REML criterion at convergence: -1111.8
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.8441 -0.3481 -0.0853  0.1822  5.4640 
## 
## Random effects:
##  Groups   Name        Variance    Std.Dev.
##  stateID  (Intercept) 0.000001466 0.001211
##  Residual             0.000014727 0.003838
## Number of obs: 169, groups:  stateID, 32
## 
## Fixed effects:
##                                  Estimate     Std. Error             df
## (Intercept)                 -0.0100527564   0.0101784349  69.0935729020
## Affluence                    0.0048776447   0.0011670489  97.8141213034
## Singletons.in.Tract          0.0016429079   0.0009999260 132.8252073221
## Seniors.in.Tract             0.0010308939   0.0013022302 143.6050000387
## African.Americans.in.Tract   0.0004283729   0.0010920384 146.5280559891
## Noncitizens.in.Tract         0.0008959363   0.0008154113 117.8935838008
## High.BP                      0.0002322437   0.0002032372  95.2298252738
## Binge.Drinking               0.0001601397   0.0001668391  39.5136811053
## Cancer                      -0.0010586382   0.0011701638  95.0090630514
## Asthma                       0.0006060166   0.0005845274  38.0987774567
## Heart.Disease                0.0011815085   0.0013752538  67.4605359577
## COPD                        -0.0002282969   0.0011569133  68.5590444867
## Smoking                     -0.0001158573   0.0002423892  72.0962296283
## Diabetes                    -0.0006224878   0.0005760877  69.9236546922
## No.Physical.Activity        -0.0000148891   0.0002172336  80.2444495425
## Obesity                      0.0002384461   0.0001860310  90.0482352115
## Poor.Sleeping.Habits        -0.0000076292   0.0001784120 121.1382984657
## Poor.Mental.Health           0.0000130418   0.0004426388  27.8455851283
## Testing_Rate                 0.0000005325   0.0000002861  31.6770512262
## Hospitalization_Rate        -0.0001074121   0.0000949175  25.7496653310
##                            t value  Pr(>|t|)    
## (Intercept)                 -0.988     0.327    
## Affluence                    4.179 0.0000636 ***
## Singletons.in.Tract          1.643     0.103    
## Seniors.in.Tract             0.792     0.430    
## African.Americans.in.Tract   0.392     0.695    
## Noncitizens.in.Tract         1.099     0.274    
## High.BP                      1.143     0.256    
## Binge.Drinking               0.960     0.343    
## Cancer                      -0.905     0.368    
## Asthma                       1.037     0.306    
## Heart.Disease                0.859     0.393    
## COPD                        -0.197     0.844    
## Smoking                     -0.478     0.634    
## Diabetes                    -1.081     0.284    
## No.Physical.Activity        -0.069     0.946    
## Obesity                      1.282     0.203    
## Poor.Sleeping.Habits        -0.043     0.966    
## Poor.Mental.Health           0.029     0.977    
## Testing_Rate                 1.861     0.072 .  
## Hospitalization_Rate        -1.132     0.268    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of fixed effects could have been required in summary()
## 
## Correlation of Fixed Effects:
##             (Intr) Afflnc Sng..T Snr..T A.A..T Nnc..T Hgh.BP Bng.Dr Cancer
## Affluence    0.148                                                        
## Sngltns.n.T -0.002  0.035                                                 
## Snrs.n.Trct  0.582  0.381  0.162                                          
## Afrcn.Am..T  0.179  0.160 -0.435  0.168                                   
## Nnctzns.n.T -0.002  0.100  0.042  0.063 -0.082                            
## High.BP      0.014  0.248  0.082  0.130 -0.105  0.391                     
## Bing.Drnkng -0.262 -0.171 -0.311 -0.158  0.104  0.042  0.133              
## Cancer      -0.591 -0.218  0.186 -0.342 -0.076 -0.152 -0.394 -0.122       
## Asthma      -0.365 -0.212 -0.218 -0.193  0.074  0.089  0.158 -0.021  0.046
## Heart.Dises -0.154  0.083 -0.292 -0.153  0.238 -0.101 -0.025  0.061 -0.461
## COPD         0.554  0.035  0.143  0.276 -0.006  0.286  0.199  0.109 -0.266
## Smoking     -0.179  0.136 -0.176 -0.114 -0.069  0.010 -0.091 -0.294  0.087
## Diabetes     0.068 -0.312 -0.152 -0.221 -0.269 -0.313 -0.532  0.054  0.229
## N.Physcl.Ac -0.172 -0.072  0.105 -0.032 -0.039 -0.234 -0.105  0.088  0.477
## Obesity      0.003  0.418  0.395  0.289  0.152  0.195 -0.085 -0.225  0.113
## Pr.Slpng.Hb -0.475 -0.415  0.177 -0.390 -0.388 -0.008 -0.190  0.066  0.157
## Pr.Mntl.Hlt -0.313  0.257 -0.059 -0.044  0.107 -0.192 -0.079  0.066  0.305
## Testing_Rat  0.182 -0.051 -0.046  0.044  0.068 -0.076 -0.008  0.032 -0.180
## Hsptlztn_Rt -0.160 -0.214 -0.090 -0.245 -0.064 -0.122 -0.122 -0.149  0.067
##             Asthma Hrt.Ds COPD   Smokng Diabts N.Ph.A Obesty Pr.S.H Pr.M.H
## Affluence                                                                 
## Sngltns.n.T                                                               
## Snrs.n.Trct                                                               
## Afrcn.Am..T                                                               
## Nnctzns.n.T                                                               
## High.BP                                                                   
## Bing.Drnkng                                                               
## Cancer                                                                    
## Asthma                                                                    
## Heart.Dises  0.274                                                        
## COPD        -0.366 -0.568                                                 
## Smoking      0.089  0.221 -0.528                                          
## Diabetes    -0.117 -0.253 -0.141  0.266                                   
## N.Physcl.Ac  0.011 -0.391  0.010 -0.338 -0.091                            
## Obesity     -0.272 -0.099  0.172 -0.212 -0.390 -0.056                     
## Pr.Slpng.Hb  0.075  0.245 -0.198  0.022 -0.015 -0.108 -0.165              
## Pr.Mntl.Hlt -0.248  0.092 -0.452  0.085  0.037  0.047  0.087 -0.196       
## Testing_Rat -0.358 -0.033  0.182  0.126  0.117 -0.301  0.110 -0.133 -0.074
## Hsptlztn_Rt  0.080  0.085 -0.110  0.083  0.062 -0.015 -0.035  0.022 -0.061
##             Tstn_R
## Affluence         
## Sngltns.n.T       
## Snrs.n.Trct       
## Afrcn.Am..T       
## Nnctzns.n.T       
## High.BP           
## Bing.Drnkng       
## Cancer            
## Asthma            
## Heart.Dises       
## COPD              
## Smoking           
## Diabetes          
## N.Physcl.Ac       
## Obesity           
## Pr.Slpng.Hb       
## Pr.Mntl.Hlt       
## Testing_Rat       
## Hsptlztn_Rt  0.188
## fit warnings:
## Some predictor variables are on very different scales: consider rescaling

Testing Rate

testing.data.state <- compiled.stats[[length(daily_filenames)]][, c("Province_State", "Testing_Rate")]
testing.data.state <- testing.data.state[!is.na(testing.data.state$Testing_Rate),]
testing.data.state <- testing.data.state[order(testing.data.state$Testing_Rate),]

col.state <- rep("pink", nrow(testing.data.state))

avg.test.rate <- mean(testing.data.state$Testing_Rate, na.rm = T)

col.state[testing.data.state$Testing_Rate < avg.test.rate] <- "grey"
col.state[testing.data.state$Province_State == "Oklahoma"] <- "lightblue"

par(mar = c(5,6,4,2))
barplot(testing.data.state$Testing_Rate, names.arg = testing.data.state$Province_State, horiz = T, main = "Testing Rate by State", las = 2, cex.axis = 1, cex.names = 0.5, col = col.state, border = F, xlab = "Total number of people tested per 100,000 persons.")
abline(v = avg.test.rate, col = "red")
text(x = avg.test.rate + 10, y = 1, labels = "Average Testing Rate", adj = c(0, 0.5), col = "red")

Pink highlights the last 14 days.

day.first.case <- min(which(US.total$cases.total > 100))
n.days <- nrow(US.total)

twoweek.col <- c(rep("grey", n.days-day.first.case-13), rep("pink", 14))

par(mar = c(5,5,4,2))
barplot(US.total$cases.total[day.first.case:n.days], 
        names = US.total$day[day.first.case:n.days],
        main = "Total COVID-19 cases by Date in US", 
        las = 2, cex.axis = 1, cex.names = 0.5,
        col = twoweek.col, border = F)

barplot(US.total$cases.total[day.first.case:n.days], 
        names = US.total$day[day.first.case:n.days],
        main = "Total COVID-19 cases by Date in US, log scale", 
        las = 2, cex.axis = 1, cex.names = 0.5, log = "y",
        col = twoweek.col, border = F)

barplot(US.total$deaths.total[day.first.case:n.days], 
        names = US.total$day[day.first.case:n.days],
        main = "Total COVID-19 deaths by Date in US", 
        las = 2, cex.axis = 1, cex.names = 0.5,
        col = twoweek.col, border = F)

barplot(US.total$deaths.total[day.first.case:n.days], 
        names = US.total$day[day.first.case:n.days],
        main = "Total COVID-19 deaths by Date in US, log scale", 
        las = 2, cex.axis = 1, cex.names = 0.5, log = "y",
        col = twoweek.col, border = F)

barplot(US.total$rise.cases.total[day.first.case:n.days], 
        names = US.total$day[day.first.case:n.days],
        main = "Rise in Cases of COVID-19 by Date in US", 
        las = 2, cex.axis = 1, cex.names = 0.5,
        col = twoweek.col, border = F)

barplot(US.total$rise.deaths.total[day.first.case:n.days], 
        names = US.total$day[day.first.case:n.days],
        main = "Rise in Deaths of COVID-19 by Date in US", 
        las = 2, cex.axis = 1, cex.names = 0.5,
        col = twoweek.col, border = F)